import * as TYPES from '../common/type'

const initialState = {
    left_num : 0,
    right_num : 0
}

export function User(state = initialState, action) {
    switch (action.type) {
        case TYPES.LOGIN_SUCCESS:
            return {
                ...action.user
            }
        case TYPES.UPDATE_USER_INFO:
            return {
                ...state,
                ...action.info
            }
        case TYPES.LOGIN_ERROR :
            return initialState
        case TYPES.LOGOUT :
            return initialState
        default:
            return state
    }
}
